package com.dq;

import org.eclipse.jetty.util.Jetty;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @ClassName TomcatCondition
 * @Description 自动加载Jetty的条件
 * @Author DuX1aoQiang
 * @Date 2023/5/19 21:39
 * @Version 1.0
 */
public class JettyCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata annotatedTypeMetadata) {
        try {
            context.getClassLoader().loadClass("org.eclipse.jetty.util.Jetty");
            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }
}
